package com.lgl.boot;

import com.lgl.client.RPCConsumer;
import com.lgl.service.IUserService;

/**
 * @Auther: Brook
 * @Date: 2020/10/18 10:00
 * @Description:
 */
public class ConsumerBoot {

    public static void main(String[] args) throws Exception {
        //1.创建代理对象
        IUserService service = (IUserService)RPCConsumer.createProxy(IUserService.class);

        //对ZooKeeper临时节点进行监听，如果服务器挂了或新增会触发监听
        RPCConsumer.addChildrenNodesWatcher();

        //2.循环给服务器写入数据
        while (true) {
            Thread.sleep(5000);
            String result = service.sayHello("How are you!");
            System.out.println("响应结果：" + result);

        }
    }
}
